#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

#include "tcp/client.h"
#include "crypto/errors.h"

int main()
{
    int fd = TcpClient("127.0.0.1", 33303);
    char buffer[4096];
    int count = 1;
    int readSize;
    while (1)
    {
        sprintf(buffer, "Send: %d", count);
        printf("%s\n", buffer);
        assert(write(fd, buffer, strlen(buffer)) >= 0);
        readSize = read(fd, buffer, 4096 - 1);
        assert(readSize >= 0);
        buffer[readSize] = '\0';
        printf("Receive from server: %s\n", buffer);
        count++;
    }
    return 0;
}